package com.recsmile.sgs.client.commonds;

import com.recsmile.sgs.client.entity.Hero;
import com.recsmile.sgs.client.entity.PlayerInfo;
import com.recsmile.sgs.client.operations.DodgeOperation;
import com.recsmile.sgs.client.ui.components.GamePanel;

public class RequestDodgeGameUIClientCommand extends GeneralGameUIClientCommand {
	
	private static final long serialVersionUID = -4208580489692790341L;

	private final PlayerInfo target;
	
	public RequestDodgeGameUIClientCommand(PlayerInfo target) {
		this.target = target;
	}

	@Override
	public void execute(GamePanel<? extends Hero> panel) {
		if (panel.getContent().getSelf().getPlayerInfo().equals(target)) {
			panel.pushOperation(new DodgeOperation(), null);
		} else {
			panel.getContent().getOtherPlayerUI(target).showCountdownBar();
		}
		
	}

}